<template>
  <div>
    <div>
      <el-button
        type="info"
        icon="el-icon-arrow-left"
        size="mini"
        @click="fanhuiClick"
        >返回</el-button
      >
    </div>

    <div>
      <el-form
        label-width="80px"
        :label-position="labelPosition"
        :inline="true"
        :model="dept"
      >
        <el-form-item label="名称">
          <el-input v-model="dept.title"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input v-model="dept.phone"></el-input>
        </el-form-item>
        <el-form-item label="传真">
          <el-input v-model="dept.fax"></el-input>
        </el-form-item>
        <el-form-item label="邮箱">
          <el-input v-model="dept.email"></el-input>
        </el-form-item>
        <el-form-item label="地址">
          <el-input v-model="dept.address"></el-input>
        </el-form-item>
        <el-form-item label="排序">
          <el-input v-model="dept.Sorting"></el-input>
        </el-form-item>

        <!-- <el-form-item label="上午上班时间">
          <el-input v-model="dept.restTimeAm" placeholder="08:00"></el-input>
        </el-form-item>
        <el-form-item label="上午下班班时间">
          <el-input v-model="dept.restTimePm" placeholder="12:00"></el-input>
        </el-form-item>
        <el-form-item label="下午下班班时间">
          <el-input v-model="dept.workTimeAm" placeholder="14:00"></el-input>
        </el-form-item>
        <el-form-item label="下午下班班时间">
          <el-input v-model="dept.workTimePm" placeholder="18:00"></el-input>
        </el-form-item> -->
      </el-form>
      <el-button type="primary" @click="addDepartment">保存</el-button>
      <el-button type="info">取消</el-button>
    </div>
  </div>
</template>

<script>
import { addDEpartment } from "../../utils/api/userControl";
export default {
  data() {
    return {
      labelPosition: "top",
      dept: {
        address: null,
        email: null,
        fax: null,
        id: null,
        phone: null,
        title: null,
        restTimeAm: null,
        restTimePm: null,
        workTimeAm: null,
        workTimePm: null,
      },
    };
  },
  methods: {
    fanhuiClick() {
      this.$router.push("/home/userViews/department");
    },
    addDepartment() {
      addDEpartment(this.dept).then((data) => {
        console.log(data);
        if (data.data.code == 200) {
          this.$router.go(-1);
        }
      });
    },
  },
};
</script>

<style scoped lang="less">
/deep/ .el-input__inner {
  width: 500px;
}

/deep/ .el-form--inline {
  padding: 0 10px;
}
</style>